package com.example.springboot.Service;

import com.example.springboot.entity.Course;
import com.example.springboot.entity.Course_select_del;
import com.example.springboot.mapper.CourseMapper;
import com.example.springboot.mapper.Course_selectMapper;
import com.example.springboot.mapper.Course_select_delMapper;
import com.example.springboot.mapper.TeacherMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DelSave {
    @Autowired
    private TeacherMapper teacherMapper;
    @Autowired
    private CourseMapper courseMapper;
    @Autowired
    private Course_selectMapper course_selectMapper;
    @Autowired
    private Course_select_delMapper course_select_delMapper;

    public Course setDelCourse(Integer course_id){
        Course course =  courseMapper.COURSE(course_id);
        course.setTeacherName(teacherMapper.findTeacheName(course.getJob_id()));
        return course;

    }

    public int insertDelC(Course_select_del course_select_del) {
//        在选课表查 选课时间
            course_select_del.setSelect_time( course_selectMapper.GetselectTime(course_select_del.getCourse_id(),course_select_del.getStudent_id()));
            if (course_select_delMapper.insertDelCourse(course_select_del)==1){
                return 1;
            }else {
                return -100;
            }


//        插入退课表



    }
}
